package com.wk.springboot.controller;

import com.wk.springboot.producer.KafkaProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping(value = "/producer")
@RestController
public class ProducerController {

    @Autowired
    KafkaProducer kafkaProducer;

    @PostMapping("sendMsg")
    public Object sendMsg(@RequestBody String str) {
        kafkaProducer.sendMessage(str, 20);
//        kafkaProducer.sendMessage("123");
        return "ok";
    }


}
